<template>
  <div class="course-item">
    <div class="item" @click="getInfoToCourse(index)" v-for="(item, index) in course">
      <div class="pic">
        <img :src="item.image" :title="item.title" />
      </div>
      <div class="info">
        <div class="name">{{item.title}}</div>
        <div class="detail" v-show="isShow == true">{{item.intro}}</div>
        <div class="teacher">{{item.teacher}}</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'CourseItem',
  data() {
    return {
      isShow: true,
      currentInner: null,
      list: [],
      data: {},
    };
  },
  props: {
    course: {
      type: Array,
      default() {
        return [];
      },
    },
  },
  methods: {
    getInfoToCourse(index) {
      this.$router.push('/studentCourse');
      // this.$router.push('/StudentExam');

      let courseInfo = this.course[index];
      this.$store.commit('getCourseInfo', courseInfo);
    },
  },
};
</script>

<style scoped>
.course-item {
  display: flex;
  flex-wrap: wrap;
}
.item {
  height: 240px;
  width: 240px;
  margin: 0 19px;
}
.item .pic {
  width: inherit;
  height: 130px;
  margin-bottom: 10px;
  border-radius: 8px;
  overflow: hidden;
}
.item .pic img {
  height: 100%;
  width: 100%;
}
.item:hover .pic {
  box-shadow: 0 0 8px 1px rgba(0, 0, 0, 0.5);
}
.item:hover .info .name {
  color: #3a8bff;
}
.item .info .name {
  color: #131b26;
  font-weight: 700;
  font-size: 16px;
  text-overflow: ellipsis;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  transition: color 0.2s;
}
.item .info .detail,
.item .info .teacher {
  font-size: 12px;
  margin-top: 10px;
}
</style>